class TransportistasController < ApplicationController
  before_action :set_transportista, only: [:show, :edit, :update, :destroy]

  # GET /transportistas
  # GET /transportistas.json
  def index
    @transportistas = Transportista.all
  end

  # GET /transportistas/1
  # GET /transportistas/1.json
  def show
  end

  # GET /transportistas/new
  def new
    @transportista = Transportista.new
  end

  # GET /transportistas/1/edit
  def edit
  end

  # POST /transportistas
  # POST /transportistas.json
  def create
    @transportista = Transportista.new(transportista_params)

    respond_to do |format|
      if @transportista.save
        format.html { redirect_to @transportista, notice: 'Transportista was successfully created.' }
        format.json { render action: 'show', status: :created, location: @transportista }
      else
        format.html { render action: 'new' }
        format.json { render json: @transportista.errors, status: :unprocessable_entity }
      end
    end
  end

  # PATCH/PUT /transportistas/1
  # PATCH/PUT /transportistas/1.json
  def update
    respond_to do |format|
      if @transportista.update(transportista_params)
        format.html { redirect_to @transportista, notice: 'Transportista was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: 'edit' }
        format.json { render json: @transportista.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /transportistas/1
  # DELETE /transportistas/1.json
  def destroy
    @transportista.destroy
    respond_to do |format|
      format.html { redirect_to transportistas_url }
      format.json { head :no_content }
    end
  end

  private
    # Use callbacks to share common setup or constraints between actions.
    def set_transportista
      @transportista = Transportista.find(params[:id])
    end

    # Never trust parameters from the scary internet, only allow the white list through.
    def transportista_params
      params.require(:transportista).permit(:ClaveProveedor, :Abreviacion, :NombreRazon, :Direccion, :Ciudad, :Estado, :CodigoPostal, :CAT, :DOT, :SCAC, :Telefono, :Fax, :Emails, :ContactoTraficoCargo, :ContactoAdminCargo, :ResponsablePagos)
    end
end
